package com.shenzhenai.it_hei_ma.a14waitandnotify;

import java.util.concurrent.ArrayBlockingQueue;

/**
 * @author huangzehui
 * @date 2025/8/29 13:25 周五
 * @description
 */
public class Foodie extends Thread {
    ArrayBlockingQueue<String> queue;

    public Foodie(ArrayBlockingQueue<String> queue) {
        this.queue = queue;
    }

    @Override
    public void run() {
        while (true){
            // 不断从阻塞队列中获取面条
            try {
                String food = queue.take();
                System.out.println("吃货正在吃: "+food);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
